home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
comm
/
bbs
/
maxsbbsus.lha
/
MAX154
/
TBM
/
Scripts
/
bkup.rex
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-04-25
|
3KB
|
77 lines
This ARexx file takes a list of files in a directory and makes a script-
file for Executing, with a command interjected in front of every name on the
list, and a destination, or whatever, tagged on afterward. It can also add a
line in between each entry, like a FailAt command.
Let's say you're a SysOp and you've got 1,000 precious MOD files. You put
a CD online and it's got 3,000 MOD files on it. You figure probably half of
yours are duplicates, so you'd just as soon delete them, to get the hard
drive space back. But actually you'd rather just move them to a different
directory, so you can check them out before giving them the ax.
The first thing you do is make a text output of the MOD files on the CD,
like "List >filename CD0:MODS short". Then pop it into your favorite text
editor and clean things up, leaving just the file names.
Make sure you've run RexxMast (System dir) to get ARexx going in the
background, and your rexxc directory should be in the paths.
Usage is: rx bkup.rex <filename>
That will take the list of names and do the following to it:
-- clip here --
/* Asher's working super-duper thingamajig - Version 1.1 */
parse arg file
command1 = 'Rename DH0:Mods/' /* goes before each name */
command2 = 'DH0:Mods2/' /* goes after */
command3 = 'FailAt 25' /* interjected between each line */
thefile = file
outf2 = 'ram:out' /* the scriptfile it makes to be Executed */
outf1 = outf2
open(thefile,file, 'r')
open(outf1, outf2, 'w')
signal loop
Loop:
do while ~eof(thefile)
xx = readln(thefile)
xx = command1 xx command2
writeln(outf1, command3) /* remove this line to take out extra command */
writeln(outf1, xx)
end
close(thefile)
say 'Done!'
exit
else do
signal loop
-- clip here --
Your scriptfile, which you'll Execute, now says:
FailAt 25
Rename DH0:Mods/ABCMOD.LHA DH0:Mods2/
FailAt 25
Rename DH0:Mods/DEFMOD.LHA DH0:Mods2/
FailAt 25
Rename DH0:Mods/GHIMOD.LHA DH0:Mods2/
FailAt 25
Rename DH0:Mods/JKLMOD.LHA DH0:Mods2/
<etc>
Then you Execute the scriptfile, and it tries to rename all the files that
have the same names as the CD files to a different directory. If it doesn't
find the file, the FailAt command keeps the scriptfile going.
There are spaces placed by the rexxfile here and there, usually it doesn't
matter. If it does, use a smart text editor and get rid of them, like with a
column delete, or a Search & Replace. CygnusEd is the best.
Have fun!